package com.api.oa.services.impl;

import com.api.oa.mapper.OrgMapper;
import com.api.oa.model.entity.OaOrg;
import com.api.oa.model.vo.OaOrgTreeVO;
import com.api.oa.services.IOaOrgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class OaOrgServiceImpl implements IOaOrgService {

    @Autowired
    private OrgMapper orgMapper;


    @Override
    public Integer add(OaOrg oaOrg) {
        return orgMapper.insert(oaOrg);
    }

    @Override
    public void remove(Long id) {
        orgMapper.delete(id);
    }

    @Override
    public Integer update(OaOrg org) {
        return orgMapper.update(org);
    }

    @Override
    public List<OaOrgTreeVO> list(Long pid) {
        return orgMapper.list(pid);
    }

    @Override
    public OaOrg one(Long id) {
        return orgMapper.findOne(id);
    }


    @Override
    public int setUser(String userId, Long orgId) {
        return orgMapper.updateUser(userId,orgId);
    }
}
